- @no_container = true
- breadcrumb_title _("Details")
- can_create_subgroups = can?(current_user, :create_subgroup, @group)

= content_for :meta_tags do
  = auto_discovery_link_tag(:atom, group_url(@group, rss_url_options), title: "#{@group.name} activity")

= render 'groups/home_panel'

.groups-listing{ class: container_class, data: { endpoints: { default: group_children_path(@group, format: :json), shared: group_shared_projects_path(@group, format: :json) } } }
  .top-area.group-nav-container
    .group-search
      = render "shared/groups/search_form"
      - if can? current_user, :create_projects, @group
        - new_project_label = _("New project")
        - new_subgroup_label = _("New subgroup")
        - if can_create_subgroups
          .btn-group.new-project-subgroup.droplab-dropdown.js-new-project-subgroup{ data: { project_path: new_project_path(namespace_id: @group.id), subgroup_path: new_group_path(parent_id: @group.id) } }
            %input.btn.btn-success.dropdown-primary.js-new-group-child{ type: "button", value: new_project_label, data: { action: "new-project" } }
            %button.btn.btn-success.dropdown-toggle.js-dropdown-toggle{ type: "button", data: { "dropdown-trigger" => "#new-project-or-subgroup-dropdown", 'display' => 'static' } }
              = icon("caret-down", class: "dropdown-btn-icon")
            %ul#new-project-or-subgroup-dropdown.dropdown-menu.dropdown-menu-right{ data: { dropdown: true } }
              %li.droplab-item-selected{ role: "button", data: { value: "new-project", text: new_project_label } }
                .menu-item
                  .icon-container
                    = icon("check", class: "list-item-checkmark")
                  .description
                    %strong= new_project_label
                    %span= s_("GroupsTree|Create a project in this group.")
              %li.divider.droplap-item-ignore
              %li{ role: "button", data: { value: "new-subgroup", text: new_subgroup_label } }
                .menu-item
                  .icon-container
                    = icon("check", class: "list-item-checkmark")
                  .description
                    %strong= new_subgroup_label
                    %span= s_("GroupsTree|Create a subgroup in this group.")
        - else
          = link_to new_project_label, new_project_path(namespace_id: @group.id), class: "btn btn-success"

    .scrolling-tabs-container.inner-page-scroll-tabs
      .fade-left= icon('angle-left')
      .fade-right= icon('angle-right')
      %ul.nav-links.scrolling-tabs.mobile-separator.nav.nav-tabs
        %li.js-subgroups_and_projects-tab
          = link_to group_path, data: { target: 'div#subgroups_and_projects', action: 'subgroups_and_projects', toggle: 'tab'} do
            = _("Subgroups and projects")
        %li.js-shared-tab
          = link_to group_shared_path, data: { target: 'div#shared', action: 'shared', toggle: 'tab'} do
            = _("Shared projects")
        %li.js-archived-tab
          = link_to group_archived_path, data: { target: 'div#archived', action: 'archived', toggle: 'tab'} do
            = _("Archived projects")

    .nav-controls
      = render "shared/groups/dropdown"

  .tab-content
    #subgroups_and_projects.tab-pane
      = render "subgroups_and_projects", group: @group

    #shared.tab-pane
      = render "shared_projects", group: @group

    #archived.tab-pane
      = render "archived_projects", group: @group
